package com.quwan.common.enums;

public enum JobTypeEnum {

    PROMOTE("推广数据统计", new Byte((byte)1)),
    RETAINED("留存报表数据统计", new Byte((byte)2)),
    FINANCE("财务报表数据统计", new Byte((byte)3)),
    MSG_SYNC("聊天消息同步", new Byte((byte)4));

    private String msg;
    private Byte code;

    private JobTypeEnum(String msg, Byte code) {
        this.msg = msg;
        this.code = code;
    }
    public static String getMsgByCode(Byte code){
        JobTypeEnum[] enums = JobTypeEnum.values();
        for (JobTypeEnum jobTypeEnum:enums){
            if(jobTypeEnum.getCode().equals(code)){
                return jobTypeEnum.getMsg();
            }
        }
        return "";
    }

    public static boolean isValidCode(Byte code) {
        for (JobTypeEnum jobTypeEnum : JobTypeEnum.values()) {
            if (code.equals(jobTypeEnum.getCode())) {
                return true;
            }
        }
        return false;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Byte getCode() {
        return code;
    }

    public void setCode(Byte code) {
        this.code = code;
    }
}
